package org.esk.dablog.gwt.dablog.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.AsyncCallback;

import java.util.List;

/**
 * This class 
 * User: esk
 * Date: 04.01.2007
 * Time: 12:35:10
 * $Id:$
 */
public interface EntryGWTService extends RemoteService {

    /**
     * returns List of forum topics
     * @return
     */
    List listForumTopics();

    /**
     * returns List of topic posts
     * @param topicId
     * @return
     */
    List listForumPosts(long topicId);

    /**
     * returns list of post comments
     * @param id
     * @return
     */
    List listPostComments(long id);

    /**
     * Utility/Convinience class.
     * Use EntryGWTService.App.getInstance () to access static instance of DablogServiceAsync
     */
    public static class App {
        private static EntryGWTServiceAsync app = null;

        public static synchronized EntryGWTServiceAsync getInstance() {
            if (app == null) {
                app = (EntryGWTServiceAsync) GWT.create(EntryGWTService.class);
                ((ServiceDefTarget) app).setServiceEntryPoint("/EntryGWTService.svc");
            }
            return app;
        }
    }
}
